# Sustainable Office Designer
# by Fabian Ritter <Fabian.Ritter@live.de>, 2012

module SOD
  
  class ConstructionManager
    
    attr_reader :footprint, :footprint_back
    attr_reader :wall, :wall_back, :floor, :floor_back, :ceiling, :ceiling_back
    attr_reader :steel, :steel_back
    
    def initialize
      
      @footprint = get_material("SOD_Footprint", Sketchup::Color.new(200, 100, 0, 1.0)) #hellbraun
      @footprint_back = @footprint
      
      @wall = get_material("SOD_Wall", Sketchup::Color.new(255, 255, 255, 1.0)) #hellblau
      @wall_back = @wall
      
      @floor = get_material("SOD_Floor", Sketchup::Color.new(128, 128, 128, 1.0)) #dunkelgrau
      @floor_back = @floor
      
      @ceiling = get_material("SOD_Ceiling", Sketchup::Color.new(220, 0, 0, 1.0)) #dunkelrot
      @ceiling_back = get_material("SOD_Ceiling-back", Sketchup::Color.new(255, 255, 255, 1.0))
      
      @steel = get_material("SOD_Steel", Sketchup::Color.new(128, 128, 128, 1.0)) #dunkelgrau
      @steel_back = @steel
      
      @core = get_material("SOD_Core", Sketchup::Color.new(128, 0, 0, 1.0))
      @core_back = get_material("SOD_Core-back", Sketchup::Color.new(0, 0, 0, 1.0))
      
      @strucWall = get_material("SOD_strucWall", Sketchup::Color.new(150, 220, 255, 0.5)) #hellblau
      
      @strucFloor = get_material("SOD_strucFloor", Sketchup::Color.new(150, 220, 255, 0.5)) #hellblau
      
      @strucCeiling = get_material("SOD_strucCeiling", Sketchup::Color.new(150, 220, 255, 0.5)) #hellblau
      @strucCeiling_back = get_material("SOD_strucCeiling-back", Sketchup::Color.new(150, 220, 255, 0.5)) #hellblau
      
    end
    
    def get_material(name, color)
      material = Sketchup.active_model.materials[name]
        if (material.nil?)
          material = Sketchup.active_model.materials.add(name)
          material.color = color
          material.alpha = color.alpha / 255.0
        end
      return(material)
    end
    
  end
  
end
